package cn.ming.wfchat.app.me.activity.model;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.ming.wfchat.R;
import cn.ming.wfchat.app.AppService;
import cn.ming.wfchat.app.me.activity.MyAssetsTopUpActivity;
import cn.ming.wfchat.app.me.activity.MyAssetsWithdrawalActivity;
import cn.ming.wfchat.kit.WfcBaseActivity;
import cn.wildfirechat.remote.ChatManager;
import cn.wildfirechat.remote.MD5Util;

/**
 * @author luoming
 * created at 2020/8/11 3:04 PM
 * 转账订单详情
 */
public class TransferOderDetailsActivity extends WfcBaseActivity {

    String OrderId;
    String coinType;
    @BindView(R.id.iv_status)
    ImageView ivStatus;
    @BindView(R.id.tv_status)
    TextView tvStatus;
    @BindView(R.id.tv_amount)
    TextView tvAmount;
    @BindView(R.id.tv_blockNumber)
    TextView tvBlockNumber;
    @BindView(R.id.tv_toAddress)
    TextView tvToAddress;
    @BindView(R.id.tv_contract)
    TextView tvContract;
    @BindView(R.id.tv_fromAddress)
    TextView tvFromAddress;
    @BindView(R.id.tv_createTime)
    TextView tvCreateTime;
    @BindView(R.id.tv_feeAmount)
    TextView tvFeeAmount;
    @BindView(R.id.tv_txHash)
    TextView tvTxHash;

    @Override
    protected int contentLayout() {
        return R.layout.transfer_order_details_activity;
    }

    @Override
    protected void afterViews() {
        super.afterViews();
        initDate();
    }

    void initDate() {
        setTitle("转账详情");
        OrderId = getIntent().getStringExtra("orderId");
        coinType = getIntent().getStringExtra("coinType");
        AppService.Instance().toTransferAccountDetail(OrderId, new AppService.TransferAccountDetailCallback() {
            @Override
            public void onUiSuccess(TransferAccountDetailBean bean) {
                if (bean.getStatus().equals("SUCCESS")) {
                    ivStatus.setImageResource(R.mipmap.icon_wancheng);
                    tvStatus.setText("成功");
                } else if (bean.getStatus().equals("FAIL")) {
                    ivStatus.setImageResource(R.mipmap.icon_jinggao);
                    tvStatus.setText("失败");
                } else {
                    ivStatus.setImageResource(R.mipmap.icon_dengdai);
                    tvStatus.setText("处理中");
                }
                tvAmount.setText(bean.getAmount() + bean.getCoinType());
                tvBlockNumber.setText(bean.getBlockNumber());
                tvContract.setText(bean.getContract());
                tvCreateTime.setText(bean.getCreateTime());
                tvFromAddress.setText(bean.getFromAddress());
                tvToAddress.setText(bean.getToAddress());
                tvTxHash.setText(bean.getTxHash());
                tvFeeAmount.setText(bean.getFeeAmount() + bean.getCoinType());
            }

            @Override
            public void onUiFailure(int code, String msg) {
            }
        });

    }

}
